package com.forenow.demo.Game;
import java.util.Random;
import java.util.Scanner;
public class ChuQuan {
    Scanner scanner=new Scanner(System.in);
    public int chuquan(String name ) {
        System.out.print("请出拳：1.剪刀 2.石头 3.布（输入相应数字）：");
        int i = scanner.nextInt();
        Random random=new Random();
        int i1= random.nextInt(3)+1;
        Rand rand=new Rand();
        Ifwin ifwin=new Ifwin();
        String jd="剪刀";
        String st="石头";
        String b="布";
        int a=0;
        switch (i){
                case 1:
                    System.out.println("你出拳：剪刀");
                    rand.isrand(i1);
                    String u1=rand.isrand(i1);
                    System.out.println(name+"出拳："+u1);
                     a=ifwin.win(u1,jd);

                    break;
                case 2:
                    System.out.println("你出拳：石头");
                    rand.isrand(i1);
                    String u2=rand.isrand(i1);
                    System.out.println(name+"出拳："+u2);
                    a=ifwin.win(u2,st);
                    break;
                case 3:
                    System.out.println("你出拳：布");
                    rand.isrand(i1);
                    String u3=rand.isrand(i1);
                    System.out.println(name+"出拳："+u3);
                    a=ifwin.win(u3,b);
                    break;
                default:
            }

            return a;
    }
}
